int libxl_domain_make(libxl_ctx *ctx, libxl_domain_create_info *info,
uint32_t *domid)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
int flags, ret, i, rc;
char *uuid_string;
char *rw_paths[] = { "device", "device/suspend/event-channel" , "data"};
const char *old_name, const char *new_name,
xs_transaction_t trans)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char *dom_path = 0;
const char *name_path;
char *got_old_name;
int libxl_domain_build(libxl_ctx *ctx, libxl_domain_build_info *info, uint32_t domid, libxl_domain_build_state *state)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char **vments = NULL, **localents = NULL;
struct timeval start_time;
int i, ret;
uint32_t domid, int fd, libxl_domain_build_state *state,
libxl_device_model_info *dm_info)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char **vments = NULL, **localents = NULL;
struct timeval start_time;
int i, ret, esave, flags;
int libxl_domain_resume(libxl_ctx *ctx, uint32_t domid)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
int rc = 0;
if (libxl__domain_is_hvm(ctx, domid)) {
int libxl_domain_preserve(libxl_ctx *ctx, uint32_t domid,
libxl_domain_create_info *info, const char *name_suffix, libxl_uuid new_uuid)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
struct xs_permissions roperm[2];
xs_transaction_t t;
char *preserved_name;
int libxl_domain_unpause(libxl_ctx *ctx, uint32_t domid)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char *path;
char *state;
int ret, rc = 0;
int libxl_domain_shutdown(libxl_ctx *ctx, uint32_t domid, int req)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char *shutdown_path;
char *dom_path;
int libxl_wait_for_disk_ejects(libxl_ctx *ctx, uint32_t guest_domid, libxl_device_disk *disks, int num_disks, libxl_waiter *waiter)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
int i, rc = -1;
uint32_t domid = libxl_get_stubdom_id(ctx, guest_domid);
int libxl_event_get_disk_eject_info(libxl_ctx *ctx, uint32_t domid, libxl_event *event, libxl_device_disk *disk)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char *path;
char *backend;
char *value;
static int libxl_destroy_device_model(libxl_ctx *ctx, uint32_t domid)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char *pid;
int ret;
int libxl_domain_destroy(libxl_ctx *ctx, uint32_t domid, int force)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char *dom_path;
char *vm_path;
int rc, dm_present;
int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num, libxl_console_constype type)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char *p = libxl__sprintf(&gc, "%s/xenconsole", libxl_private_bindir_path());
char *domid_s = libxl__sprintf(&gc, "%d", domid);
char *cons_num_s = libxl__sprintf(&gc, "%d", cons_num);
int libxl_vncviewer_exec(libxl_ctx *ctx, uint32_t domid, int autopass)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
const char *vnc_port, *vfb_back;
const char *vnc_listen = NULL, *vnc_pass = NULL;
int port = 0, autopass_fd = -1;
return 0;
}
-static char ** libxl_build_device_model_args_old(libxl_gc *gc,
+static char ** libxl_build_device_model_args_old(libxl__gc *gc,
libxl_device_model_info *info,
libxl_device_nic *vifs,
int num_vifs)
return (char **) flexarray_contents(dm_args);
}
-static char ** libxl_build_device_model_args_new(libxl_gc *gc,
+static char ** libxl_build_device_model_args_new(libxl__gc *gc,
libxl_device_model_info *info,
libxl_device_nic *vifs,
int num_vifs)
else
flexarray_set(dm_args, num++, "xenfv");
- disks = libxl_device_disk_list(libxl_gc_owner(gc), info->domid, &nb);
+ disks = libxl_device_disk_list(libxl__gc_owner(gc), info->domid, &nb);
for (i; i < nb; i++) {
if ( disks[i].is_cdrom ) {
flexarray_set(dm_args, num++, "-cdrom");
return (char **) flexarray_contents(dm_args);
}
-static char ** libxl_build_device_model_args(libxl_gc *gc,
+static char ** libxl_build_device_model_args(libxl__gc *gc,
libxl_device_model_info *info,
libxl_device_nic *vifs,
int num_vifs)
{
- libxl_ctx *ctx = libxl_gc_owner(gc);
+ libxl_ctx *ctx = libxl__gc_owner(gc);
int new_qemu;
new_qemu = libxl_check_device_model_version(ctx, info->device_model);
static int libxl_write_dmargs(libxl_ctx *ctx, int domid, int guest_domid, char **args)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
int i;
char *vm_path;
char *dmargs, *path;
libxl_device_vkb *vkb,
libxl_device_model_starting **starting_r)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
int i, num_console = 1, ret;
libxl_device_console *console;
libxl_domain_create_info c_info;
libxl_device_nic *vifs, int num_vifs,
libxl_device_model_starting **starting_r)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char *path, *logfile;
int logfile_w, null;
int rc;
if (!*starting_r)
goto out_close;
p = *starting_r;
- p->for_spawn = calloc(sizeof(libxl_spawn_starting), 1);
+ p->for_spawn = calloc(sizeof(libxl__spawn_starting), 1);
} else {
p = &buf_starting;
p->for_spawn = NULL;
int libxl_device_disk_add(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
flexarray_t *front;
flexarray_t *back;
char *backend_type;
unsigned int boffset = 0;
unsigned int foffset = 0;
int devid;
- libxl_device device;
+ libxl__device device;
int major, minor, rc;
front = flexarray_make(16, 1);
int libxl_device_disk_del(libxl_ctx *ctx,
libxl_device_disk *disk, int wait)
{
- libxl_device device;
+ libxl__device device;
int devid;
devid = libxl__device_disk_dev_number(disk->virtpath);
char * libxl_device_disk_local_attach(libxl_ctx *ctx, libxl_device_disk *disk)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
const char *dev = NULL;
char *ret;
int phystype = disk->phystype;
/******************************************************************************/
int libxl_device_nic_add(libxl_ctx *ctx, uint32_t domid, libxl_device_nic *nic)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
flexarray_t *front;
flexarray_t *back;
unsigned int boffset = 0;
unsigned int foffset = 0;
- libxl_device device;
+ libxl__device device;
char *dompath, **l;
unsigned int nb, rc;
int libxl_device_nic_del(libxl_ctx *ctx,
libxl_device_nic *nic, int wait)
{
- libxl_device device;
+ libxl__device device;
device.backend_devid = nic->devid;
device.backend_domid = nic->backend_domid;
libxl_nicinfo *libxl_list_nics(libxl_ctx *ctx, uint32_t domid, unsigned int *nb)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char *dompath, *nic_path_fe;
char **l, **list;
char *val, *tok;
/******************************************************************************/
int libxl_device_net2_add(libxl_ctx *ctx, uint32_t domid, libxl_device_net2 *net2)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
flexarray_t *front, *back;
unsigned int boffset = 0, foffset = 0;
- libxl_device device;
+ libxl__device device;
char *dompath, *dom, **l;
unsigned int nb;
int rc;
libxl_net2info *libxl_device_net2_list(libxl_ctx *ctx, uint32_t domid, unsigned int *nb)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char *dompath, *net2_path_fe;
char **l;
char *val, *tok;
int libxl_device_net2_del(libxl_ctx *ctx, libxl_device_net2 *net2, int wait)
{
- libxl_device device;
+ libxl__device device;
device.backend_devid = net2->devid;
device.backend_domid = net2->backend_domid;
/******************************************************************************/
int libxl_device_console_add(libxl_ctx *ctx, uint32_t domid, libxl_device_console *console)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
flexarray_t *front;
flexarray_t *back;
unsigned int boffset = 0;
unsigned int foffset = 0;
- libxl_device device;
+ libxl__device device;
int rc;
if (console->build_state) {
/******************************************************************************/
int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
flexarray_t *front;
flexarray_t *back;
unsigned int boffset = 0;
unsigned int foffset = 0;
- libxl_device device;
+ libxl__device device;
int rc;
front = flexarray_make(16, 1);
libxl_device_disk *libxl_device_disk_list(libxl_ctx *ctx, uint32_t domid, int *num)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char *be_path_tap, *be_path_vbd;
libxl_device_disk *dend, *disks, *ret = NULL;
char **b, **l = NULL;
int libxl_device_disk_getinfo(libxl_ctx *ctx, uint32_t domid,
libxl_device_disk *disk, libxl_diskinfo *diskinfo)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char *dompath, *diskpath;
char *val;
}
/******************************************************************************/
-static int libxl_build_xenpv_qemu_args(libxl_gc *gc,
+static int libxl_build_xenpv_qemu_args(libxl__gc *gc,
uint32_t domid,
libxl_device_vfb *vfb,
libxl_device_model_info *info)
{
- libxl_ctx *ctx = libxl_gc_owner(gc);
+ libxl_ctx *ctx = libxl__gc_owner(gc);
memset(info, 0x00, sizeof(libxl_device_model_info));
if (vfb != NULL) {
int libxl_create_xenpv_qemu(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb,
libxl_device_model_starting **starting_r)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
libxl_device_model_info info;
libxl_build_xenpv_qemu_args(&gc, domid, vfb, &info);
int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
flexarray_t *front;
flexarray_t *back;
unsigned int boffset = 0;
unsigned int foffset = 0;
- libxl_device device;
+ libxl__device device;
int rc;
front = flexarray_make(16, 1);
int libxl_domain_setmaxmem(libxl_ctx *ctx, uint32_t domid, uint32_t max_memkb)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char *mem, *endptr;
uint32_t memorykb;
char *dompath = libxl__xs_get_dompath(&gc, domid);
int libxl_set_memory_target(libxl_ctx *ctx, uint32_t domid, uint32_t target_memkb, int enforce)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
int rc = 1;
uint32_t memorykb = 0, videoram = 0;
char *memmax, *endptr, *videoram_s = NULL;
int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, uint32_t bitmask)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
libxl_dominfo info;
char *dompath;
xs_transaction_t t;
int libxl_send_sysrq(libxl_ctx *ctx, uint32_t domid, char sysrq)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char *dompath = libxl__xs_get_dompath(&gc, domid);
libxl__xs_write(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/control/sysrq", dompath), "%c", sysrq);
uint32_t libxl_vm_get_start_time(libxl_ctx *ctx, uint32_t domid)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char *dompath = libxl__xs_get_dompath(&gc, domid);
char *vm_path, *start_time;
uint32_t ret;
* should be allocated from the temporary pool.
*
* Where a function's primary purpose is to return such an object,
- * it should have a libxl_gc * as it's first argument.
+ * it should have a libxl__gc * as it's first argument.
*
* Note that there are two ways to change an allocation from this
* category to the "public" category. Either the implementation
* The latter method is preferred for obvious performance reasons.
*
* No temporary objects allocated from the pool may be explicitly freed.
- * Therefore public functions which initialize a libxl_gc MUST call
+ * Therefore public functions which initialize a libxl__gc MUST call
* libxl__free_all() before returning.
*/
#ifndef LIBXL_H
#include "tap-ctl.h"
-int libxl__blktap_enabled(libxl_gc *gc)
+int libxl__blktap_enabled(libxl__gc *gc)
{
const char *msg;
return !tap_ctl_check(&msg);
}
-const char *libxl__blktap_devpath(libxl_gc *gc,
+const char *libxl__blktap_devpath(libxl__gc *gc,
const char *disk,
libxl_disk_phystype phystype)
{
#define XENCONSOLED_BUF_SIZE 16
#define BOOTLOADER_BUF_SIZE 1024
-static char **make_bootloader_args(libxl_gc *gc,
+static char **make_bootloader_args(libxl__gc *gc,
libxl_domain_build_info *info,
uint32_t domid,
const char *fifo, char *disk)
* if there is actual data to write, otherwise this would loop too fast,
* eating up CPU time.
*/
-static char * bootloader_interact(libxl_gc *gc, int xenconsoled_fd, int bootloader_fd, int fifo_fd)
+static char * bootloader_interact(libxl__gc *gc, int xenconsoled_fd, int bootloader_fd, int fifo_fd)
{
int ret;
libxl_device_disk *disk,
uint32_t domid)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
int ret, rc = 0;
char *fifo = NULL;
char *diskpath = NULL;
[DEVICE_CONSOLE] = "console",
};
-int libxl__device_generic_add(libxl_ctx *ctx, libxl_device *device,
+int libxl__device_generic_add(libxl_ctx *ctx, libxl__device *device,
char **bents, char **fents)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char *dom_path_backend, *dom_path, *frontend_path, *backend_path;
xs_transaction_t t;
struct xs_permissions frontend_perms[2];
int libxl__device_destroy(libxl_ctx *ctx, char *be_path, int force)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
xs_transaction_t t;
char *state_path = libxl__sprintf(&gc, "%s/state", be_path);
char *state = libxl__xs_read(&gc, XBT_NULL, state_path);
static int wait_for_dev_destroy(libxl_ctx *ctx, struct timeval *tv)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
int nfds, rc;
unsigned int n;
fd_set rfds;
int libxl__devices_destroy(libxl_ctx *ctx, uint32_t domid, int force)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char *path, *be_path, *fe_path;
unsigned int num1, num2;
char **l1 = NULL, **l2 = NULL;
return 0;
}
-int libxl__device_del(libxl_ctx *ctx, libxl_device *dev, int wait)
+int libxl__device_del(libxl_ctx *ctx, libxl__device *dev, int wait)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char *dom_path_backend, *backend_path;
int rc;
void *userdata),
void *check_callback_userdata)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char *path;
char *p;
unsigned int len;
int libxl__wait_for_backend(libxl_ctx *ctx, char *be_path, char *state)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
int watchdog = 100;
unsigned int len;
char *p;
libxl_domain_build_info *info, libxl_domain_build_state *state,
char **vms_ents, char **local_ents)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char *dom_path, *vm_path;
xs_transaction_t t;
char **ents;
int libxl__build_hvm(libxl_ctx *ctx, uint32_t domid,
libxl_domain_build_info *info, libxl_domain_build_state *state)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
int ret, rc = ERROR_INVAL;
if (info->kernel.mapped) {
}
struct suspendinfo {
- libxl_gc *gc;
+ libxl__gc *gc;
int xce; /* event channel handle */
int suspend_eventchn;
int domid;
int ret;
char *path, *state = "suspend";
int watchdog = 60;
- libxl_ctx *ctx = libxl_gc_owner(si->gc);
+ libxl_ctx *ctx = libxl__gc_owner(si->gc);
if (si->hvm)
xc_get_hvm_param(ctx->xch, si->domid, HVM_PARAM_ACPI_S_STATE, &s_state);
int libxl__domain_suspend_common(libxl_ctx *ctx, uint32_t domid, int fd,
int hvm, int live, int debug)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
int flags;
int port;
struct save_callbacks callbacks;
int libxl__domain_save_device_model(libxl_ctx *ctx, uint32_t domid, int fd)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
int fd2, c;
char buf[1024];
char *filename = libxl__sprintf(&gc, "/var/lib/xen/qemu-save.%d", domid);
return 0;
}
-char *libxl__uuid2string(libxl_gc *gc, const libxl_uuid uuid)
+char *libxl__uuid2string(libxl__gc *gc, const libxl_uuid uuid)
{
char *s = libxl__sprintf(gc, LIBXL_UUID_FMT, LIBXL_UUID_BYTES(uuid));
if (!s)
- LIBXL__LOG(libxl_gc_owner(gc), LIBXL__LOG_ERROR, "cannot allocate for uuid");
+ LIBXL__LOG(libxl__gc_owner(gc), LIBXL__LOG_ERROR, "cannot allocate for uuid");
return s;
}
-static const char *userdata_path(libxl_gc *gc, uint32_t domid,
+static const char *userdata_path(libxl__gc *gc, uint32_t domid,
const char *userdata_userid,
const char *wh)
{
- libxl_ctx *ctx = libxl_gc_owner(gc);
+ libxl_ctx *ctx = libxl__gc_owner(gc);
char *path, *uuid_string;
libxl_dominfo info;
int rc;
void libxl__userdata_destroyall(libxl_ctx *ctx, uint32_t domid)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
const char *pattern;
glob_t gl;
int r, i;
const char *userdata_userid,
const uint8_t *data, int datalen)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
const char *filename;
const char *newfilename;
int e, rc;
const char *userdata_userid,
uint8_t **data_r, int *datalen_r)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
const char *filename;
int e, rc;
int datalen = 0;
pid_t child, got;
int status;
pid_t intermediate;
- libxl_spawn_starting *for_spawn = starting->for_spawn;
+ libxl__spawn_starting *for_spawn = starting->for_spawn;
if (for_spawn) {
for_spawn->what = strdup(what);
}
static void report_spawn_intermediate_status(libxl_ctx *ctx,
- libxl_spawn_starting *for_spawn,
+ libxl__spawn_starting *for_spawn,
int status)
{
if (!WIFEXITED(status)) {
}
int libxl__spawn_detach(libxl_ctx *ctx,
- libxl_spawn_starting *for_spawn)
+ libxl__spawn_starting *for_spawn)
{
int r, status;
pid_t got;
int libxl__spawn_check(libxl_ctx *ctx, void *for_spawn_void)
{
- libxl_spawn_starting *for_spawn = for_spawn_void;
+ libxl__spawn_starting *for_spawn = for_spawn_void;
pid_t got;
int status;
return 0;
}
-int libxl__ptr_add(libxl_gc *gc, void *ptr)
+int libxl__ptr_add(libxl__gc *gc, void *ptr)
{
int i;
void **re;
return 0;
}
-void libxl__free_all(libxl_gc *gc)
+void libxl__free_all(libxl__gc *gc)
{
void *ptr;
int i;
free(gc->alloc_ptrs);
}
-void *libxl__zalloc(libxl_gc *gc, int bytes)
+void *libxl__zalloc(libxl__gc *gc, int bytes)
{
void *ptr = calloc(bytes, 1);
if (!ptr) {
- libxl__error_set(libxl_gc_owner(gc), ENOMEM);
+ libxl__error_set(libxl__gc_owner(gc), ENOMEM);
return NULL;
}
return ptr;
}
-void *libxl__calloc(libxl_gc *gc, size_t nmemb, size_t size)
+void *libxl__calloc(libxl__gc *gc, size_t nmemb, size_t size)
{
void *ptr = calloc(nmemb, size);
if (!ptr) {
- libxl__error_set(libxl_gc_owner(gc), ENOMEM);
+ libxl__error_set(libxl__gc_owner(gc), ENOMEM);
return NULL;
}
return ptr;
}
-char *libxl__sprintf(libxl_gc *gc, const char *fmt, ...)
+char *libxl__sprintf(libxl__gc *gc, const char *fmt, ...)
{
char *s;
va_list ap;
return s;
}
-char *libxl__strdup(libxl_gc *gc, const char *c)
+char *libxl__strdup(libxl__gc *gc, const char *c)
{
char *s = strdup(c);
return s;
}
-char *libxl__dirname(libxl_gc *gc, const char *s)
+char *libxl__dirname(libxl__gc *gc, const char *s)
{
char *c;
char *ptr = libxl__strdup(gc, s);
va_end(ap);
}
-char *libxl__abs_path(libxl_gc *gc, char *s, const char *path)
+char *libxl__abs_path(libxl__gc *gc, char *s, const char *path)
{
if (!s || s[0] == '/')
return s;
DEVICE_VFB,
DEVICE_VKBD,
DEVICE_CONSOLE,
-} libxl_device_kinds;
+} libxl__device_kinds;
#define is_valid_device_kind(kind) (((kind) >= DEVICE_VIF) && ((kind) <= DEVICE_CONSOLE))
uint32_t backend_domid;
uint32_t devid;
uint32_t domid;
- libxl_device_kinds backend_kind;
- libxl_device_kinds kind;
-} libxl_device;
+ libxl__device_kinds backend_kind;
+ libxl__device_kinds kind;
+} libxl__device;
#define XC_PCI_BDF "0x%x, 0x%x, 0x%x, 0x%x"
#define AUTO_PHP_SLOT 0x100
int alloc_maxsize;
void **alloc_ptrs;
libxl_ctx *owner;
-} libxl_gc;
+} libxl__gc;
-#define LIBXL_INIT_GC(ctx) (libxl_gc){ .alloc_maxsize = 0, .alloc_ptrs = 0, .owner = ctx }
-static inline libxl_ctx *libxl_gc_owner(libxl_gc *gc)
+#define LIBXL_INIT_GC(ctx) (libxl__gc){ .alloc_maxsize = 0, .alloc_ptrs = 0, .owner = ctx }
+static inline libxl_ctx *libxl__gc_owner(libxl__gc *gc)
{
return gc->owner;
}
/* memory allocation tracking/helpers */
-_hidden int libxl__ptr_add(libxl_gc *gc, void *ptr);
-_hidden void libxl__free_all(libxl_gc *gc);
-_hidden void *libxl__zalloc(libxl_gc *gc, int bytes);
-_hidden void *libxl__calloc(libxl_gc *gc, size_t nmemb, size_t size);
-_hidden char *libxl__sprintf(libxl_gc *gc, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 3);
-_hidden char *libxl__strdup(libxl_gc *gc, const char *c);
-_hidden char *libxl__dirname(libxl_gc *gc, const char *s);
-
-_hidden char **libxl__xs_kvs_of_flexarray(libxl_gc *gc, flexarray_t *array, int length);
-_hidden int libxl__xs_writev(libxl_gc *gc, xs_transaction_t t,
+_hidden int libxl__ptr_add(libxl__gc *gc, void *ptr);
+_hidden void libxl__free_all(libxl__gc *gc);
+_hidden void *libxl__zalloc(libxl__gc *gc, int bytes);
+_hidden void *libxl__calloc(libxl__gc *gc, size_t nmemb, size_t size);
+_hidden char *libxl__sprintf(libxl__gc *gc, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 3);
+_hidden char *libxl__strdup(libxl__gc *gc, const char *c);
+_hidden char *libxl__dirname(libxl__gc *gc, const char *s);
+
+_hidden char **libxl__xs_kvs_of_flexarray(libxl__gc *gc, flexarray_t *array, int length);
+_hidden int libxl__xs_writev(libxl__gc *gc, xs_transaction_t t,
char *dir, char **kvs);
-_hidden int libxl__xs_write(libxl_gc *gc, xs_transaction_t t,
+_hidden int libxl__xs_write(libxl__gc *gc, xs_transaction_t t,
char *path, char *fmt, ...) PRINTF_ATTRIBUTE(4, 5);
-_hidden char *libxl__xs_get_dompath(libxl_gc *gc, uint32_t domid); // logs errs
-_hidden char *libxl__xs_read(libxl_gc *gc, xs_transaction_t t, char *path);
-_hidden char **libxl__xs_directory(libxl_gc *gc, xs_transaction_t t, char *path, unsigned int *nb);
+_hidden char *libxl__xs_get_dompath(libxl__gc *gc, uint32_t domid); // logs errs
+_hidden char *libxl__xs_read(libxl__gc *gc, xs_transaction_t t, char *path);
+_hidden char **libxl__xs_directory(libxl__gc *gc, xs_transaction_t t, char *path, unsigned int *nb);
/* from xl_dom */
_hidden int libxl__domain_is_hvm(libxl_ctx *ctx, uint32_t domid);
_hidden int libxl__device_physdisk_major_minor(const char *physpath, int *major, int *minor);
_hidden int libxl__device_disk_dev_number(char *virtpath);
-_hidden int libxl__device_generic_add(libxl_ctx *ctx, libxl_device *device,
+_hidden int libxl__device_generic_add(libxl_ctx *ctx, libxl__device *device,
char **bents, char **fents);
-_hidden int libxl__device_del(libxl_ctx *ctx, libxl_device *dev, int wait);
+_hidden int libxl__device_del(libxl_ctx *ctx, libxl__device *dev, int wait);
_hidden int libxl__device_destroy(libxl_ctx *ctx, char *be_path, int force);
_hidden int libxl__devices_destroy(libxl_ctx *ctx, uint32_t domid, int force);
_hidden int libxl__wait_for_device_model(libxl_ctx *ctx,
/* all fields are private to libxl_spawn_... */
pid_t intermediate;
char *what; /* malloc'd in spawn_spawn */
-} libxl_spawn_starting;
+} libxl__spawn_starting;
struct libxl__device_model_starting {
- libxl_spawn_starting *for_spawn; /* first! */
+ libxl__spawn_starting *for_spawn; /* first! */
char *dom_path; /* from libxl_malloc, only for dm_xenstore_record_pid */
int domid;
};
* Caller, may pass 0 for for_spawn, in which case no need to detach.
*/
_hidden int libxl__spawn_detach(libxl_ctx *ctx,
- libxl_spawn_starting *for_spawn);
+ libxl__spawn_starting *for_spawn);
/* Logs errors. Idempotent, but only permitted after successful
* call to libxl__spawn_spawn, and no point calling it again if it fails. */
_hidden int libxl__spawn_check(libxl_ctx *ctx,
void *for_spawn);
/* Logs errors but also returns them.
- * for_spawn must actually be a libxl_spawn_starting* but
+ * for_spawn must actually be a libxl__spawn_starting* but
* we take void* so you can pass this function directly to
* libxl__wait_for_device_model. Caller must still call detach. */
/* low-level stuff, for synchronous subprocesses etc. */
_hidden void libxl__exec(int stdinfd, int stdoutfd, int stderrfd, char *arg0, char **args); // logs errors, never returns
-_hidden void libxl__log_child_exitstatus(libxl_gc *gc,
+_hidden void libxl__log_child_exitstatus(libxl__gc *gc,
const char *what, pid_t pid, int status);
-_hidden char *libxl__abs_path(libxl_gc *gc, char *s, const char *path);
+_hidden char *libxl__abs_path(libxl__gc *gc, char *s, const char *path);
#define LIBXL__LOG_DEBUG XTL_DEBUG
#define LIBXL__LOG_INFO XTL_INFO
#define LIBXL__LOG_WARNING XTL_WARN
#define LIBXL__LOG_ERROR XTL_ERROR
-_hidden char *libxl__domid_to_name(libxl_gc *gc, uint32_t domid);
-_hidden char *libxl__poolid_to_name(libxl_gc *gc, uint32_t poolid);
+_hidden char *libxl__domid_to_name(libxl__gc *gc, uint32_t domid);
+_hidden char *libxl__poolid_to_name(libxl__gc *gc, uint32_t poolid);
/*
* blktap2 support
/* libxl__blktap_enabled:
* return true if blktap/blktap2 support is available.
*/
-_hidden int libxl__blktap_enabled(libxl_gc *gc);
+_hidden int libxl__blktap_enabled(libxl__gc *gc);
/* libxl__blktap_devpath:
* Argument: path and disk image as specified in config file.
* returns device path xenstore wants to have. returns NULL
* if no device corresponds to the disk.
*/
-_hidden const char *libxl__blktap_devpath(libxl_gc *gc,
+_hidden const char *libxl__blktap_devpath(libxl__gc *gc,
const char *disk,
libxl_disk_phystype phystype);
-_hidden char *libxl__uuid2string(libxl_gc *gc, const libxl_uuid uuid);
+_hidden char *libxl__uuid2string(libxl__gc *gc, const libxl_uuid uuid);
struct libxl__xen_console_reader {
char *buffer;
#include "libxl_osdeps.h"
#include "libxl_internal.h"
-int libxl__blktap_enabled(libxl_gc *gc)
+int libxl__blktap_enabled(libxl__gc *gc)
{
return 0;
}
-const char *libxl__blktap_devpath(libxl_gc *gc,
+const char *libxl__blktap_devpath(libxl__gc *gc,
const char *disk,
libxl_disk_phystype phystype)
{
return ERROR_INVAL;
}
-static int libxl_create_pci_backend(libxl_gc *gc, uint32_t domid, libxl_device_pci *pcidev, int num)
+static int libxl_create_pci_backend(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev, int num)
{
- libxl_ctx *ctx = libxl_gc_owner(gc);
+ libxl_ctx *ctx = libxl__gc_owner(gc);
flexarray_t *front;
flexarray_t *back;
unsigned int boffset = 0;
unsigned int foffset = 0;
- libxl_device device;
+ libxl__device device;
int i;
front = flexarray_make(16, 1);
return 0;
}
-static int libxl_device_pci_add_xenstore(libxl_gc *gc, uint32_t domid, libxl_device_pci *pcidev)
+static int libxl_device_pci_add_xenstore(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev)
{
- libxl_ctx *ctx = libxl_gc_owner(gc);
+ libxl_ctx *ctx = libxl__gc_owner(gc);
flexarray_t *back;
char *num_devs, *be_path;
int num = 0;
return 0;
}
-static int libxl_device_pci_remove_xenstore(libxl_gc *gc, uint32_t domid, libxl_device_pci *pcidev)
+static int libxl_device_pci_remove_xenstore(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev)
{
- libxl_ctx *ctx = libxl_gc_owner(gc);
+ libxl_ctx *ctx = libxl__gc_owner(gc);
char *be_path, *num_devs_path, *num_devs, *xsdev, *tmp, *tmppath;
int num, i, j;
xs_transaction_t t;
return 0;
}
-static int get_all_assigned_devices(libxl_gc *gc, libxl_device_pci **list, int *num)
+static int get_all_assigned_devices(libxl__gc *gc, libxl_device_pci **list, int *num)
{
libxl_device_pci *pcidevs = NULL;
char **domlist;
int libxl_device_pci_list_assignable(libxl_ctx *ctx, libxl_device_pci **list, int *num)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
libxl_device_pci *pcidevs = NULL, *new, *assigned;
struct dirent *de;
DIR *dir;
* driver. It also initialises a bit-mask of which function numbers are present
* on that device.
*/
-static int pci_multifunction_check(libxl_gc *gc, libxl_device_pci *pcidev, unsigned int *func_mask)
+static int pci_multifunction_check(libxl__gc *gc, libxl_device_pci *pcidev, unsigned int *func_mask)
{
- libxl_ctx *ctx = libxl_gc_owner(gc);
+ libxl_ctx *ctx = libxl__gc_owner(gc);
struct dirent *de;
DIR *dir;
return 1;
}
-static int do_pci_add(libxl_gc *gc, uint32_t domid, libxl_device_pci *pcidev)
+static int do_pci_add(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev)
{
- libxl_ctx *ctx = libxl_gc_owner(gc);
+ libxl_ctx *ctx = libxl__gc_owner(gc);
char *path;
char *state, *vdevfn;
int rc, hvm;
return 0;
}
-static int libxl_device_pci_reset(libxl_gc *gc, unsigned int domain, unsigned int bus,
+static int libxl_device_pci_reset(libxl__gc *gc, unsigned int domain, unsigned int bus,
unsigned int dev, unsigned int func)
{
- libxl_ctx *ctx = libxl_gc_owner(gc);
+ libxl_ctx *ctx = libxl__gc_owner(gc);
char *reset;
int fd, rc;
int libxl_device_pci_add(libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
unsigned int orig_vdev, pfunc_mask;
libxl_device_pci *assigned;
int num_assigned, i, rc;
return rc;
}
-static int do_pci_remove(libxl_gc *gc, uint32_t domid, libxl_device_pci *pcidev)
+static int do_pci_remove(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev)
{
- libxl_ctx *ctx = libxl_gc_owner(gc);
+ libxl_ctx *ctx = libxl__gc_owner(gc);
libxl_device_pci *assigned;
char *path;
char *state;
int libxl_device_pci_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
unsigned int orig_vdev, pfunc_mask;
int i, rc;
int libxl_device_pci_list_assigned(libxl_ctx *ctx, libxl_device_pci **list, uint32_t domid, int *num)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char *be_path, *num_devs, *xsdev, *xsvdevfn, *xsopts;
int n, i;
unsigned int domain = 0, bus = 0, dev = 0, func = 0, vdevfn = 0;
return s;
}
-char *libxl__domid_to_name(libxl_gc *gc, uint32_t domid)
+char *libxl__domid_to_name(libxl__gc *gc, uint32_t domid)
{
- char *s = libxl_domid_to_name(libxl_gc_owner(gc), domid);
+ char *s = libxl_domid_to_name(libxl__gc_owner(gc), domid);
if ( s )
libxl__ptr_add(gc, s);
return s;
return s;
}
-char *libxl__poolid_to_name(libxl_gc *gc, uint32_t poolid)
+char *libxl__poolid_to_name(libxl__gc *gc, uint32_t poolid)
{
- char *s = libxl_poolid_to_name(libxl_gc_owner(gc), poolid);
+ char *s = libxl_poolid_to_name(libxl__gc_owner(gc), poolid);
if ( s )
libxl__ptr_add(gc, s);
return s;
int libxl_get_stubdom_id(libxl_ctx *ctx, int guest_domid)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char * stubdom_id_s;
int ret;
int libxl_is_stubdom(libxl_ctx *ctx, uint32_t domid, uint32_t *target_domid)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char *target, *endptr;
uint32_t value;
int ret = 0;
int libxl_create_logfile(libxl_ctx *ctx, char *name, char **full_name)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
struct stat stat_buf;
char *logfile, *logfile_new;
int i, rc;
int libxl_devid_to_device_nic(libxl_ctx *ctx, uint32_t domid,
const char *devid, libxl_device_nic *nic)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char *tok, *val;
char *dompath, *nic_path_fe, *nic_path_be;
unsigned int i;
int libxl_devid_to_device_disk(libxl_ctx *ctx, uint32_t domid,
const char *devid, libxl_device_disk *disk)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char *endptr, *val;
char *dompath, *diskpath, *be_path;
unsigned int devid_n;
int libxl_devid_to_device_net2(libxl_ctx *ctx, uint32_t domid,
const char *devid, libxl_device_net2 *net2)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
char *tok, *endptr, *val;
char *dompath, *net2path, *be_path;
unsigned int devid_n, i;
int libxl_check_device_model_version(libxl_ctx *ctx, char *path)
{
- libxl_gc gc = LIBXL_INIT_GC(ctx);
+ libxl__gc gc = LIBXL_INIT_GC(ctx);
pid_t pid = -1;
int pipefd[2];
char buf[100];
return 0;
}
-char **libxl__xs_kvs_of_flexarray(libxl_gc *gc, flexarray_t *array, int length)
+char **libxl__xs_kvs_of_flexarray(libxl__gc *gc, flexarray_t *array, int length)
{
char **kvs;
int i;
return kvs;
}
-int libxl__xs_writev(libxl_gc *gc, xs_transaction_t t,
+int libxl__xs_writev(libxl__gc *gc, xs_transaction_t t,
char *dir, char *kvs[])
{
- libxl_ctx *ctx = libxl_gc_owner(gc);
+ libxl_ctx *ctx = libxl__gc_owner(gc);
char *path;
int i;
return 0;
}
-int libxl__xs_write(libxl_gc *gc, xs_transaction_t t,
+int libxl__xs_write(libxl__gc *gc, xs_transaction_t t,
char *path, char *fmt, ...)
{
- libxl_ctx *ctx = libxl_gc_owner(gc);
+ libxl_ctx *ctx = libxl__gc_owner(gc);
char *s;
va_list ap;
int ret;
return 0;
}
-char * libxl__xs_read(libxl_gc *gc, xs_transaction_t t, char *path)
+char * libxl__xs_read(libxl__gc *gc, xs_transaction_t t, char *path)
{
- libxl_ctx *ctx = libxl_gc_owner(gc);
+ libxl_ctx *ctx = libxl__gc_owner(gc);
char *ptr;
ptr = xs_read(ctx->xsh, t, path, NULL);
return 0;
}
-char *libxl__xs_get_dompath(libxl_gc *gc, uint32_t domid)
+char *libxl__xs_get_dompath(libxl__gc *gc, uint32_t domid)
{
- libxl_ctx *ctx = libxl_gc_owner(gc);
+ libxl_ctx *ctx = libxl__gc_owner(gc);
char *s = xs_get_domain_path(ctx->xsh, domid);
if (!s) {
LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to get dompath for %" PRIu32,
return s;
}
-char **libxl__xs_directory(libxl_gc *gc, xs_transaction_t t, char *path, unsigned int *nb)
+char **libxl__xs_directory(libxl__gc *gc, xs_transaction_t t, char *path, unsigned int *nb)
{
- libxl_ctx *ctx = libxl_gc_owner(gc);
+ libxl_ctx *ctx = libxl__gc_owner(gc);
char **ret = NULL;
ret = xs_directory(ctx->xsh, XBT_NULL, path, nb);
libxl__ptr_add(gc, ret);